'''
1、我的方法找重复,找 丢失

'''
from collections import Counter
def findErrorNums(self, nums):
    result = []
    nums.sort()
    map=Counter(nums)

    ##找重复
    for k,v in map.items():
        if v == 2:
            result.append(k)
            break

    ##找丢失 
    for i in range(1,len(nums)+1):
        if i not in map:
            result.append(i)
            break
            
    return result

'''
找一个重可以直接  利用 a=sum(数组)-sum(set(数组))
找丢失           利用 b=sum(未丢失的)-sum(去重后的)
                    return [a,b]
'''
def findErrorNums(nums):
    setNums = set(nums)
    ## 找重
    a = sum(nums) - sum(setNums)
    ## 找丢失
    b = sum(range(1,len(nums)+1))-sum(setNums)
    return [a,b]
